Method and apparatus for triggering terminal behavior based on environmental and terminal status parameters

ABSTRACT

Embodiments of the present invention disclose a terminal behavior triggering method and a terminal. The method includes: detecting an environment parameter of a terminal and a terminal status parameter of the terminal; determining a target situation event based on the environment parameter and/or the terminal status parameter; and if the environment parameter meets a first preset condition, and the terminal status parameter meets a second preset condition, triggering a terminal behavior corresponding to the target situation event.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.16/465,789, filed on May 31, 2019, which is a national stage ofInternational Application No. PCT/CN2017/088308, filed on Jun. 14, 2017,which claims priority to Chinese Patent Application No. 201611097005.6,filed on Dec. 2, 2016 and Chinese Patent Application No. 201710194152.3,filed on Mar. 28, 2017. All of the aforementioned patent applicationsare hereby incorporated by reference in their entireties.

TECHNICAL FIELD

This application relates to the field of communications technologies,and in particular, to a terminal behavior triggering method and aterminal.

BACKGROUND

With continuous development of communications technologies, terminals(such as a smartphone, a tablet computer, and a wearable device)gradually become indispensable tools in daily life, work, and study ofpeople.

In the prior art, a terminal may detect many environment parametersassociated with the terminal. When these environment parameters meet aspecific preset condition, the terminal may be considered to be in aparticular situation event. In this case, if a correspondence between asituation event and a terminal behavior is set, the terminal may betriggered to perform a corresponding behavior, so as to automaticallytrigger a terminal behavior based on an environment parameter.

For example, the terminal may first set a preset condition of“Disconnect from a cellular network if Wireless Fidelity (WirelessFidelity, WiFi) is successfully connected, or automatically (ormanually) connect to a cellular network if WiFi is not connected” innetwork management. In addition, the terminal detects, in real time,whether there is an environment parameter of a WiFi signal. If a WiFisignal is detected, the terminal may be considered to be in a situationevent in which a network switchover can be performed. Then, the terminalmay be triggered, based on the preset condition, to disconnect from thecellular network, and connect to the WiFi.

However, a correspondence between an environment parameter and aterminal behavior is excessively simple, and sometimes a terminalbehavior triggered by an environment parameter affects normal use of theterminal. Consequently intelligence of the terminal is reduced. Still inthe foregoing example, when a user uses navigation in driving, theterminal may automatically connect to a WiFi access point on theroadside as a location changes. However, the connection to the WiFiaccess point requires login. In this case, if the cellular network isautomatically disabled, an intelligent terminal disconnects from theInternet. Consequently navigation becomes abnormal, normal use of anavigation function of the terminal is affected, and intelligence of theterminal is reduced.

SUMMARY

A technical problem to be resolved in embodiments of the presentinvention is how to make a terminal behavior triggering manner moreintelligent. A terminal behavior triggering method and a terminal areprovided, so as to improve intelligence of the terminal.

According to a first aspect, an embodiment of the present inventionprovides a terminal behavior triggering method. First, an environmentparameter of a terminal and a terminal status parameter of the terminalare detected; then, a target situation event is determined based on theenvironment parameter and/or the terminal status parameter; and if theenvironment parameter meets a first preset condition, and the terminalstatus parameter meets a second preset condition, a terminal behaviorcorresponding to the target situation event is triggered.

It may be learned that in the method provided in the first aspect, boththe environment parameter and the terminal status parameter aredetected, so that the triggered terminal behavior better meets userexpectation, thereby improving intelligence of the terminal.

In an optional implementation, before detecting the environmentparameter and the terminal status parameter, the terminal may furtherobtain one or more environment parameters in advance, and if the one ormore environment parameters meet a third preset condition, establish acorrespondence between the one or more environment parameters and asituation event.

It may be learned that in this optional implementation, a correspondencebetween an environment parameter and a situation event may beautomatically established in advance, so that the target situation eventcorresponding to the environment parameter can be obtained moreaccurately and efficiently.

In an optional implementation, before detecting the environmentparameter and the terminal status parameter, the terminal may furtherobtain one or more terminal status parameters in advance, and if the oneor more terminal status parameters meet a fourth preset condition,establish a correspondence between the one or more terminal statusparameters and a situation event.

It may be learned that in this optional implementation, a correspondencebetween a terminal status parameter and a situation event may beautomatically established in advance, so that the target situation eventcorresponding to the terminal status parameter can be obtained moreaccurately and efficiently.

In an optional implementation, the target situation event may include anaccidental situation event or a non-accidental situation event; and whenthe target situation event is a non-accidental situation event, thetriggered terminal behavior corresponding to the target situation eventis a behavior performed by the terminal without prompting a user; orwhen the target situation event is an accidental situation event, thetriggered terminal behavior corresponding to the target situation eventis a behavior performed by the terminal after the terminal prompts auser and obtains user confirmation.

It may be learned that in this optional implementation, a manner ofperforming the behavior triggered by the terminal may be adjusted basedon a type of the target situation event, so as to improve intelligenceof the terminal.

In an optional implementation, that the terminal determines a targetsituation event based on the environment parameter and/or the terminalstatus parameter may be specifically: obtaining preset priorities, andselecting, based on the priorities, a parameter with a higher priorityfrom the environment parameter and the terminal status parameter, todetermine the target situation event.

It may be learned that in this optional implementation, whether thetarget situation event is determined by using the environment parameteror the terminal status parameter may be determined based on thepriorities, so as to improve intelligence of the terminal.

In an optional implementation, that the terminal obtains presetpriorities, and selects, based on the preset priorities, a parameterwith a higher priority from the environment parameter and the terminalstatus parameter, to determine the target situation event may bespecifically: if a current operation of the user on the terminal isdetected, determining that a priority of a terminal status parameterthat is obtained based on the current operation is higher than apriority of the environment parameter; and determining the targetsituation event based on the terminal status parameter that is obtainedbased on the current operation.

It may be learned that in this optional implementation, the priority ofthe terminal status parameter that is obtained based on the currentoperation of the user may be higher than the priority of the environmentparameter by default, so as to improve intelligence of the terminal.

In an optional implementation, the environment parameter includes atleast one of a location parameter, a network type parameter, atemperature parameter, a luminance parameter, a speed parameter, an airquality parameter, and a human physiological parameter.

In an optional implementation, the terminal status parameter includes aterminal status parameter triggered by a user operation; and theterminal status parameter triggered by the user operation includes atleast one of a running program status parameter, an unlocked stateparameter, a screen-locked state parameter, and a hardware touch statusparameter.

According to a second aspect, a terminal is provided. The terminal has afunction of implementing a behavior of the terminal in the first aspector the possible implementations of the first aspect. The function may beimplemented by hardware, or may be implemented by hardware by executingcorresponding software. The hardware or the software includes one ormore modules corresponding to the foregoing function. The module may besoftware and/or hardware. Based on a same inventive concept, for aproblem-resolving principle and beneficial effects of the terminal,refer to the first aspect, the possible method implementations of thefirst aspect, and the brought beneficial effects. Therefore, forimplementation of the terminal, refer to the first aspect and thepossible method implementations of the first aspect. Repeated parts arenot described.

According to a third aspect, a terminal is provided. The terminalincludes: a memory, configured to store one or more programs; and aprocessor, configured to invoke the program stored in the memory, toimplement the solution in the method design of the first aspect. For aproblem-resolving implementation and beneficial effects of the terminal,refer to the first aspect, the possible method implementations of thefirst aspect, and the beneficial effects. Repeated parts are notdescribed.

According to a fourth aspect, a computer readable storage medium isprovided. The computer storage medium stores a computer program, and thecomputer program includes a program instruction. When the programinstruction is executed by a processor, the processor performs themethod in the first aspect, the possible method implementations of thefirst aspect, and the beneficial effects. Repeated parts are notdescribed.

According to a fifth aspect, a computer program product is provided.When the computer program product runs on a computer, the computerperforms the method in the first aspect and the possible methodimplementations of the first aspect.

BRIEF DESCRIPTION OF THE DRAWINGS

To describe the technical solutions in the embodiments of the presentinvention more clearly, the following briefly describes the accompanyingdrawings required for describing the embodiments. Apparently, theaccompanying drawings in the following description show some embodimentsof this application, and a person of ordinary skill in the art may stillderive other drawings from these accompanying drawings without creativeefforts.

FIG. 1 is a schematic flowchart of a terminal behavior triggering methodaccording to an embodiment of the present invention;

FIGS. 2A and 2B are a schematic tables of terminal behavior triggeringaccording to an embodiment of the present invention. FIG. 2 indicateshow the table of FIG. 2A relates to the table of FIG. 2B;

FIG. 3 is another schematic table of terminal behavior triggeringaccording to an embodiment of the present invention;

FIG. 4 is a schematic flowchart of another terminal behavior triggeringmethod according to an embodiment of the present invention;

FIG. 5 is a schematic table of a terminal status parameter according toan embodiment of the present invention;

FIG. 6 is a schematic table of an environment parameter according to anembodiment of the present invention;

FIG. 7 is a schematic table of another terminal status parameteraccording to an embodiment of the present invention;

FIG. 8 is a schematic structural diagram of a terminal according to anembodiment of the present invention; and

FIG. 9 is a schematic structural diagram of another terminal accordingto an embodiment of the present invention.

DETAILED DESCRIPTION OF ILLUSTRATIVE EMBODIMENTS

The following describes the embodiments of the present invention withreference to the accompanying drawings in the embodiments of the presentinvention.

The embodiments of the present invention provide a terminal behaviortriggering method and a terminal, so as to improve intelligence of theterminal. Details are described below separately.

To better understand the terminal behavior triggering method and theterminal that are provided in the embodiments of the present invention,the following first describes method embodiments of the presentinvention.

It should be noted that the terminal may be various types of intelligentterminals, for example, terminals that may process various types ofsignals, such as a smartphone, a tablet computer, a wearable device, acomputer, a personal digital assistant (English: Personal DigitalAssistant, PDA for short), and a mobile Internet device (English: MobileInternet Device, MID for short).

Referring to FIG. 1 , FIG. 1 is a schematic flowchart of a terminalbehavior triggering method according to the present invention. As shownin FIG. 1 , an embodiment of the present invention includes thefollowing steps.

101. A terminal detects an environment parameter of the terminal and aterminal status parameter of the terminal.

It should be noted that the environment parameter may be a parameterused to describe a change status of an environment in which the terminalis located.

Specifically, the environment parameter may be content directly outputby a sensor after the sensor of the terminal detects the change statusof the environment, for example, a location parameter, a temperatureparameter, a luminance parameter, a speed parameter, a network typeparameter, an air quality parameter, or a human physiological parameter(a heart rate value, a quantity of steps, or the like).

The network type parameter may specifically include a WiFi parameter, acellular network parameter, and the like. This is not limited herein.

A specific type of environment parameter needs to be detected by using asensor of the type. For example, if a location needs to be detected, aGlobal Positioning System (Global Positioning System, GPS) sensor may beused for implementation. Output of the GPS sensor may be provided by anoperating system or specially-encapsulated functions, and currentlongitude and latitude coordinates of the terminal can be obtained bycalling these functions.

Alternatively, the terminal performs semantic analysis on contentdirectly output by a sensor, to obtain content, and the obtained contentmay be used as the environment parameter. For example, the terminaldetects ambient air quality, to obtain content about whether it isappropriate to go outside today, and the obtained content may be used asthe environment parameter; or the terminal detects a heart rate of ahuman body, to obtain content about whether a user is in a motion state,and the obtained content may be used as the environment parameter.

Alternatively, the environment parameter may be a parameter that isobtained by a sensor by accumulating information of different time andthen performing comprehensive determining based on the accumulatedinformation. For example, a location sensor detects that a user islocated at a location A from 11 p.m. to 7 a.m. and at a location B from9 a.m. to 5 p.m. for at least five days in a week. In this case, it maybe comprehensively determined that the location A is home, and thelocation B is a company.

It should be further noted that the sensor may be built in the terminal,or may be located on another device, and send collected data to theterminal by using a data communication mechanism. For example, theterminal may invoke, as the environment parameter, data that is obtainedby a wearable device (such as a smartwatch) that establishes a wirelesscommunication connection to the terminal.

It should be further noted that the sensor may be a hardware-typesensor, or may be software or a service. For example, informationprovided by the software may also be considered as the environmentparameter, for example, a message sent by a friend is received in socialapplication software, or a post is replied.

It should be further noted that the terminal status parameter includes aterminal status parameter triggered by a user operation. The terminalstatus parameter triggered by the user operation includes at least oneof a running program status parameter, an unlocked state parameter, ascreen-locked state parameter, and a hardware touch status parameter.

The running program status parameter may be a parameter in which astatus of an application changes when the user performs an operation onthe application on the terminal. For example, the user performs anoperation on a music application program named “xx”, and the musicapplication program starts to play a song named “AAA”. In this case, therunning program status parameter may be specifically “an applicationname=‘xx music’ and a song name=‘AAA’”.

Alternatively, the running program status parameter may be a parameterin which a status of a system program changes when the user performs atouch operation (the touch operation may also be recorded by theterminal as the hardware touch status parameter) on human-computerinteraction hardware on the terminal. For example, the user touches abutton on the terminal that is used for increasing volume. In this case,the hardware touch status parameter may be “The button used forincreasing the volume is touched”. Further, due to the hardware touchstatus parameter, a status of the system program is changed to a stateof increasing the volume of the terminal, and the status of the systemprogram may further be recorded by the terminal as the running programstatus parameter.

In a specific implementation, the terminal status parameter may bedetected by using the human-computer interaction hardware (for example,a touchscreen, a keyboard, or a microphone) and corresponding software,and one or more corresponding terminal status parameters are obtained.For example, after the user runs a particular application by using thetouchscreen, the operating system can learn that the specificapplication is running, and can also learn that the terminal iscurrently in a screen-locked state, an unlocked state, or the like.

102. The terminal determines a target situation event based on theenvironment parameter and/or the terminal status parameter.

It should be noted that there may be a plurality of situation events.The target situation event may be an event that is corresponding to theenvironment parameter and that is selected from the plurality ofsituation events.

It should be further noted that the terminal may determine the targetsituation event based on the environment parameter, or may determine thetarget situation event based on the terminal status parameter, or maydetermine the target situation event based on both the terminal statusparameter and the environment parameter.

When determining the target situation event based on the environmentparameter, specifically, the terminal may determine the target situationevent only when the environment parameter meets a first presetcondition. Then, the terminal may further detect the terminal statusparameter, and determine whether the terminal status parameter meets thesecond preset condition.

For example, referring to FIG. 2A, in a row numbered 01, the environmentparameter of the terminal indicates that the terminal currently finds aWiFi signal that can be connected, and a cellular network of theterminal is being used. Therefore, the terminal may determine that theenvironment parameter meets a first preset condition of “The WiFi signalcan be connected, and the cellular network is being used”, and theterminal may determine, based on the first preset condition, that thetarget situation event is “A network switchover can be performed:automatically disconnect from the cellular network when WiFi isconnected, or automatically enable the cellular network when WiFi is notconnected”. Then, the terminal may further detect the terminal statusparameter, and determine whether the terminal status parameter meets thesecond preset condition.

When determining the target situation event based on the terminal statusparameter, specifically, the terminal may determine the target situationevent only when the terminal status parameter meets the second presetcondition. Then, the terminal may further detect the environmentparameter, and determine whether the environment parameter meets thefirst preset condition.

For example, the second preset condition is specifically “A musicapplication program runs in any time period between 11 p.m. and 7 a.m.,and running duration is more than one hour”. As shown in FIG. 3 , in arow numbered 05, the terminal status parameter indicates that theterminal runs a music application program from 1 a.m. to 3 a.m., andrunning duration is two hours. Therefore, the terminal may determinethat the terminal status parameter meets the second preset condition of“A music application program runs in any time period between 11 p.m. and7 a.m., and running duration is more than one hour”, and the terminalmay determine, based on the second preset condition, that the targetsituation event is “Close the music application program”.

When determining the target situation event based on both the terminalstatus parameter and the environment parameter, specifically, theterminal may determine the target situation event only when the terminalstatus parameter meets the second preset condition, and the environmentparameter meets the first preset condition.

For example, as shown in FIG. 2A, in the row numbered 01, the firstpreset condition may be specifically “The WiFi signal can be connected,and the cellular network is being used”, and the second preset conditionmay be specifically “Navigation used for driving in a terminal is beingused”. If the terminal detects that the environment parameter meets thefirst preset condition of “The WiFi signal can be connected, and thecellular network is being used”, and the terminal status parameter meetsthe second preset condition of “Navigation used for driving in aterminal is being used”, the terminal may determine that the targetsituation event is “A network switchover can be performed: automaticallydisconnect from the cellular network when WiFi is connected, orautomatically enable the cellular network when WiFi is not connected”.

It should be further noted that when the terminal determines the targetsituation event based on both the terminal status parameter and theenvironment parameter, the terminal has determined the target situationevent based on the first preset condition and the second presetcondition (in other words, the terminal status parameter and theenvironment parameter respectively meet the second preset condition andthe first preset condition before the target situation event isdetermined). Therefore, when triggering a corresponding terminalbehavior, the terminal may not further determine whether the terminalstatus parameter and the environment parameter respectively meet thesecond preset condition and the first preset condition, but may directlytrigger the corresponding terminal behavior after the target situationevent is determined.

Optionally, the terminal may first obtain preset priorities, and thenselect, based on the priorities, a parameter with a higher priority fromthe environment parameter and the terminal status parameter, todetermine the target situation event.

In some feasible implementations, if the terminal detects that the usercurrently does not perform any operation on the terminal, the terminalmay determine that a priority of the environment parameter is higherthan a priority of the terminal status parameter, and the terminal maypreferentially determine the target situation event by using theenvironment parameter.

Optionally, if the terminal detects a current operation of the user onthe terminal, the terminal may determine that a priority of a terminalstatus parameter that is obtained based on the current operation ishigher than a priority of the environment parameter, and the terminalmay preferentially determine the target situation event based on theterminal status parameter that is obtained based on the currentoperation.

103. If the environment parameter meets a first preset condition, andthe terminal status parameter meets a second preset condition, theterminal triggers a terminal behavior corresponding to the targetsituation event.

It should be noted that the first preset condition and the second presetcondition may vary in specific condition content because the environmentparameter and the terminal status parameter respective corresponding tothe first preset condition and the second preset condition aredifferent.

It should be further noted that if the target situation event isdetermined based on the environment parameter, specifically, the targetsituation event may be determined based on that the environmentparameter meets the first preset condition. In other words, theenvironment parameter meets the first preset condition before the targetsituation event is determined based on the environment parameter. Thenthe terminal determines whether the terminal status parameter meets thesecond preset condition, and if the terminal status parameter meets thesecond preset condition, triggers the terminal behavior corresponding tothe target situation event.

It should be further noted that the terminal behavior may be a behaviorthat is performed by the terminal based on a preset behavior rule whenthe environment parameter and the terminal status parameter meetrespective corresponding conditions. For example, as shown in the rownumbered 01 in FIG. 2A, the terminal may preset a behavior rule as “Whena user is driving, the terminal does not disconnect from the cellularnetwork even if a WiFi signal can be connected”, and then preset, basedon the behavior rule, the first preset condition of “The WiFi signal canbe connected, and the cellular network is being used” and the secondpreset condition of “A navigation program used for driving in a terminalis being used”. If the environment parameter meets the first presetcondition, and the terminal status parameter meets the second presetcondition, the terminal may determine, based on the preset behaviorrule, to perform a terminal behavior of “Continue to use the cellularnetwork, and not to connect to the WiFi”.

In an embodiment, as shown in FIG. 2A, in the row numbered 01, the firstpreset condition may be specifically “The WiFi signal can be connected,and the cellular network is being used”. If the terminal detects thatthe environment parameter meets the first preset condition of “The WiFisignal can be connected, and the cellular network is being used”, theterminal may determine, based on the first preset condition, that thetarget situation event is “A network switchover can be performed:automatically disconnect from the cellular network when WiFi isconnected, or automatically enable the cellular network when WiFi is notconnected”, and then further detect the terminal status parameter tofind out whether a navigation program runs. If the terminal detects thatthe navigation program runs, and a “driving navigation mode” isexecuted, the terminal may determine that the terminal status parametermeets the second preset condition of “Navigation used for driving in aterminal is being used”, and may further determine that the terminalbehavior corresponding to the target situation event is “Continue to usethe cellular network, and not to connect to the WiFi”.

In some feasible implementations, the terminal may alternativelydetermine, together with the terminal status parameter and theenvironment parameter, whether the terminal status parameter meets thesecond preset condition. For example, in the foregoing example, theterminal detects the terminal status parameter to find out whether anavigation program runs. If the terminal detects that the navigationprogram runs, and determines, based on a speed sensor, that sensor datameets a driving state, the terminal may determine that the terminalstatus parameter meets the second preset condition of “Navigation usedfor driving in a terminal is being used”, and may determine that theterminal behavior corresponding to the target situation event is“Continue to use the cellular network, and not to connect to the WiFi”.

For another example, as shown in FIG. 2A, in a row numbered 02, thefirst preset condition may be specifically “The WiFi signal can beconnected, and the cellular network is being used”. If the terminaldetects that the environment parameter meets the first preset conditionof “The WiFi signal can be connected, and the cellular network is beingused”, the terminal may determine, based on the first preset condition,that the target situation event is “A network switchover can beperformed: automatically disconnect from the cellular network when WiFiis connected, or automatically enable the cellular network when WiFi isnot connected”, and then further detect the terminal status parameter tofind out whether a navigation program runs. If the terminal detects thata music program runs, the terminal may determine that the terminalstatus parameter meets a second preset condition of “No navigation usedfor driving in a terminal is being used”, and may further determine thatthe terminal behavior corresponding to the target situation event is“Connect to the WiFi, and disconnect from the cellular network”.

In an embodiment, as shown in FIG. 2B, in a row numbered 03, the firstpreset condition may be specifically “The location A is an area in which“home” is located”. If the environment parameter indicates that theterminal is located at the location A, and meets the first presetcondition of “The location A is an area in which ‘home’ is located”, theterminal may determine, based on the first preset condition, that thetarget situation event is “Go home”, and then further detect theterminal status parameter. If it is detected that the terminal iscurrently in a screen-locked state, and screen-locking duration is 10minutes, the terminal may determine that the terminal status parametermeets a second preset condition of “A user performs no current operationon the terminal within 10 minutes”, and may further determine that theterminal behavior corresponding to the target situation event is “Lightup a screen, and display prompt information of ‘whether to adjust adesktop application icon to a home mode’”.

In an embodiment, as shown in FIG. 2B, in a row numbered 04, the firstpreset condition may be specifically “The location B is an area in which‘company’ is located”. If the environment parameter indicates that theterminal is located at the location B, and meets the first presetcondition of “The location B is an area in which ‘company’ is located”,the terminal may determine, based on the first preset condition, thatthe target situation event is “Go to work”, and then further detect theterminal status parameter. If it is detected that the terminal iscurrently in a screen-locked state, and screen-locking duration is 10minutes, the terminal may determine that the terminal status parametermeets a second preset condition of “A user performs no current operationon the terminal within 10 minutes”, and may further determine that theterminal behavior corresponding to the target situation event is “Lightup a screen, and display prompt information of ‘whether to adjust adesktop application icon to an office mode’”.

Similarly, if the target situation event is determined based on theterminal status parameter, the target situation event may be determinedbased on that the terminal status parameter meets the second presetcondition. Then, the terminal determines whether the environmentparameter meets the first preset condition, and if the environmentparameter meets the first preset condition, triggers the terminalbehavior corresponding to the target situation event.

In an embodiment, as shown in FIG. 3 , in the row numbered 05, thesecond preset condition may be specifically “A music application programruns in any time period between 11 p.m. and 7 a.m., and running durationis more than one hour”. If the terminal status parameter indicates thatthe terminal is running a music program named “xx music”, the musicapplication program runs from 1 a.m. to 3 a.m., and running duration istwo hours, and the terminal status parameter meets the second presetcondition of “A music application program runs in any time periodbetween 11 p.m. and 7 a.m., and running duration is more than one hour”,the terminal may determine, based on the second preset condition, thatthe target situation event is “Close the music application program”.Then, the terminal further detects the environment parameter. If it isdetected that the terminal is currently located at the location A, atime period ranges from 9 p.m. to 3 a.m., and duration is six hours, theterminal may determine that the terminal status parameter meets thefirst preset condition of “The location A is an area in which “home” islocated”, and may further determine that the terminal behaviorcorresponding to the target situation event is to close the musicprogram named “xx music”.

In an embodiment, as shown in FIG. 3 , in a row numbered 06, the secondpreset condition may be specifically “A music application program runsin any time period between 10 p.m. and 7 a.m., and running duration ismore than one hour”. If the terminal status parameter indicates that theterminal is running a music program named “xx music”, the musicapplication program runs from 1 a.m. to 3 a.m., and running duration istwo hours, and the terminal status parameter meets the second presetcondition of “A music application program runs in any time periodbetween 11 p.m. and 7 a.m., and running duration is more than one hour”,the terminal may determine, based on the second preset condition, thatthe target situation event is “Close the music application program”.Then, the terminal further detects the environment parameter. If it isdetected that the terminal is currently located at a location C, a timeperiod ranges from 12 a.m. to 3 a.m., and duration is three hours, theterminal may determine that the terminal status parameter meets a firstpreset condition of “The location A is an area in which ‘home’ islocated”, and may further determine that the terminal behaviorcorresponding to the target situation event is “Prompt a user whether toclose the music program named ‘xx music’”.

It should be further noted that the environment parameter and theterminal status parameter may be independently detected by the terminal.In other words, the terminal records both the environment parameter andthe terminal status parameter, and determines whether the otherparameter meets a condition regardless of which parameter is used totrigger the terminal behavior.

In some feasible embodiments, when triggering a corresponding behavior,the terminal may not need to perform deep semantic analysis on theenvironment parameter and the terminal status parameter, but directlytrigger the corresponding behavior based on a condition. For example,current longitude and latitude coordinates of the terminal that areobtained by a GPS sensor are 23.67 degrees north latitude and 104.06degrees east longitude, and this is the same as a condition preset bythe terminal for triggering a behavior of “Adjust a desktop applicationicon to a home mode”, so that the terminal may be triggered to performthe behavior of “Adjust a desktop application icon to a home mode”.

In this embodiment of the present invention, the terminal first detectsthe environment parameter and the terminal status parameter of theterminal, and then determines the target situation event based on theenvironment parameter and/or the terminal status parameter. If theenvironment parameter meets the first preset condition, and the terminalstatus parameter meets the second preset condition, the terminaltriggers the terminal behavior corresponding to the target situationevent. Both the environment parameter and the terminal status parameterare detected, so that the triggered terminal behavior better meets userexpectation, thereby improving intelligence of the terminal.

Referring to FIG. 4 , FIG. 4 shows a terminal behavior triggering methodaccording to the present invention. As shown in FIG. 4 , an embodimentof the present invention includes the following steps.

401. A terminal obtains one or more terminal status parameters of theterminal.

It should be noted that the terminal status parameter includes aterminal status parameter triggered by a user operation. The terminalstatus parameter triggered by the user operation includes at least oneof a running program status parameter, an unlocked state parameter, ascreen-locked state parameter, and a hardware touch status parameter.

In a specific implementation, an operation performed by the user on theterminal, for example, running an application program, unlocking ascreen, locking a screen, or the like, may be detected by an interfaceencapsulated by an operating system of the terminal, and then theterminal may invoke, based on a requirement, the interface to obtainstatus information of the terminal, namely, the terminal statusparameter.

In an embodiment, as shown in FIG. 5 , FIG. 5 is a schematic table of aterminal status parameter according to an embodiment of the presentinvention. The schematic table shown in FIG. 5 may be a table ofterminal statuses recorded by the terminal at 17:20 Beijing time on May20, 2017. It may be learned that the terminal status parameter shown inFIG. 5 may specifically include a plurality of types of parameters suchas a status parameter type, a status parameter description, a currentrunning location, a number, and last operation time of the user.Specifically, it may be learned from the schematic table shown in FIG. 5that a program currently running in a foreground on the terminal is “xxmap”, programs running in a background are “xx wallet” and “xx music”,and the terminal is in an unlocked state.

402. If the one or more terminal status parameters of the terminal meeta fourth preset condition, the terminal establishes a correspondencebetween the one or more terminal status parameters of the terminal and asituation event.

In a specific implementation, after recording the schematic table of theterminal statuses, the terminal may determine whether a terminal statusparameter in the schematic table meets the fourth preset condition, andif a terminal status parameter in the schematic table meets the fourthpreset condition, establish a correspondence between the one or moreterminal status parameters and a situation event.

For example, as shown in FIG. 5 , content in each of rows numbered 501to 504 is a terminal status parameter recorded by the terminal at 00:20on May 20, 2017. It may be learned that the terminal may record eachterminal status parameter in real time, and establish a data table. Thedata table may include list entries such as a “terminal status parametertype”, a “terminal status parameter description”, a “current runninglocation”, a “number”, and “last operation time of a user”, and then theterminal may record content corresponding to each terminal statusparameter in a corresponding list entry.

The terminal may determine, based on the data table at a same moment,one or more target situation events. This is not limited in thisembodiment of the present invention.

It should be noted that the fourth preset condition is used to determinea correspondence between a terminal status parameter and a situationevent. In some particular cases, the fourth preset condition may be thesame as the second preset condition. For example, when the targetsituation event is determined based on the terminal status parameter,the fourth preset condition may be the same as the second presetcondition.

For example, as shown in FIG. 7 , when the terminal determines thetarget situation event based on the terminal status parameter, aterminal status parameter in a row numbered 701 indicates that theterminal runs a music application program at 23:10, and duration is 1hour 10 minutes, and the terminal status parameter meets a fourth presetcondition of “A music application program runs in any time periodbetween 11 p.m. and 7 a.m., and running duration is more than one hour”.The fourth preset condition is the same as a second preset condition inrows numbered 01 and 02 in FIG. 3 , so that the terminal may determine,based on the fourth preset condition, that a situation eventcorresponding to the terminal status parameter is “Close the musicapplication program”.

It should be further noted that when the terminal determines the targetsituation event based on an environment parameter, the fourth presetcondition may be different from the second preset condition.

For another example, when the target situation event is determined basedon the environment parameter, with reference to a row numbered 03 inFIG. 2B, if the environment parameter indicates that the terminal islocated at a location A, and meets a first preset condition of “Thelocation A is an area in which ‘home’ is located”, the terminal maydetermine, based on the first preset condition, that the targetsituation event is “Go home”. Then, the terminal further detects theterminal status parameter (in this case, the terminal status parameteris used to determine whether the terminal needs to perform acorresponding terminal behavior). Then, with reference to the terminalstatus parameter that is in the row numbered 701 in FIG. 7 and that canindicate that the terminal is currently in a screen-locked state andscreen-locking duration is five minutes, the terminal may determine thatthe terminal status parameter does not meet a second preset condition of“A user performs no current operation on the terminal within 10minutes”, but meets a fourth preset condition of “A terminal is in ascreen-locked state at 00:15”. In this case, if the user sets, inadvance, to send a bedtime notification at 00:15, the terminal maydetermine, based on the fourth preset condition, that another targetsituation event is “Prompt a user to go to bed”, but does not perform aterminal behavior of “Light up a screen, and display prompt informationof ‘whether to adjust a desktop application icon to a home mode’” thatis performed only when the second preset condition is met.

Optionally, the terminal may further obtain one or more environmentparameters. If the one or more environment parameters meet a thirdpreset condition, a correspondence between the one or more environmentparameters and a situation event is established.

Similarly, the third preset condition is used to determine acorrespondence between an environment parameter and a situation event.In some particular cases, the third preset condition may be the same asthe first preset condition. For example, when the target situation eventis determined based on the environment parameter, the third presetcondition may be the same as the first preset condition; and when theterminal determines the target situation event based on the terminalstatus parameter, the third preset condition may be different from thefirst preset condition.

For example, when the target situation event is determined based on theenvironment parameter, if the terminal detects that the environmentparameter is “A WiFi signal is detected, and a cellular network is beingused”, and meets a third preset condition of “The WiFi signal can beconnected, and the cellular network is being used”, the third presetcondition is the same as a first preset condition in a row numbered 01in FIG. 2A, and the terminal may determine, based on the third presetcondition, a corresponding target situation event is “A networkswitchover can be performed: automatically disconnect from the cellularnetwork when WiFi is connected, or automatically enable the cellularnetwork when WiFi is not connected”.

For another example, as shown in FIG. 7 , when the target situationevent is determined based on the terminal status parameter, the terminaldetermines, based on the terminal status parameter corresponding to theevent number 701, that a situation event is “Close the music applicationprogram”, and then the terminal may further detect the environmentparameter (in this case, the environment parameter is used to determinewhether the terminal needs to perform a corresponding terminalbehavior). If the environment parameter is “A terminal is located at alocation B, accumulated duration=6 hours, and a time period=‘9 p.m. to 1a.m.’”, a location A does not exist in the environment parameter;therefore, the environment parameter does not meet the first presetcondition of “The location A is an area in which ‘home’ is located”, butmeets a third preset condition of “The location B is an area in which‘company’ is located”. In this case, the terminal may determine, basedon the third preset condition, that another target situation event is“Go to work”, but the terminal does not perform a terminal behavior of“Close a music program named ‘xx music’” that is performed only when thefirst preset condition is met.

Optionally, the target situation event may include an accidentalsituation event or a non-accidental situation event. If the targetsituation event is a non-accidental situation event, the triggeredterminal behavior corresponding to the target situation event is abehavior performed by the terminal without prompting a user.Alternatively, if the target situation event is an accidental situationevent, the triggered terminal behavior corresponding to the targetsituation event is a behavior performed by the terminal after theterminal prompts a user and obtains user confirmation.

It should be noted that the terminal may further determine, based on aquantity of accumulated event occurrence times, whether the targetsituation event is an accidental situation event or a non-accidentalsituation event. If the target situation event is an accidentalsituation event, the terminal behavior corresponding to the targetsituation event may be the behavior performed by the terminal withoutprompting the user. If the target situation event is an accidentalsituation event, the terminal behavior corresponding to the targetsituation event may be the behavior performed by the terminal after theterminal prompts the user and obtains the user confirmation.

In an embodiment, as shown in FIG. 6 , in a situation eventcorresponding to an event number 601, a quantity of accumulated eventoccurrence times counted by the terminal is 100, and is greater than 50(50 is a lowest threshold of the non-accidental situation event).Therefore, when a terminal behavior corresponding to the non-accidentalsituation event is triggered, the terminal may directly perform thecorresponding terminal behavior without prompting the user.

In an embodiment, as shown in FIG. 7 , in a situation eventcorresponding to an event number 701, a quantity of accumulated eventoccurrence times counted by the terminal is 100, and is greater than 50(50 is a lowest threshold of the non-accidental situation event).Therefore, when a terminal behavior corresponding to the non-accidentalsituation event is triggered, the terminal may directly perform thecorresponding terminal behavior without prompting the user. In asituation event corresponding to an event number 702, a quantity ofaccumulated event occurrence times counted by the terminal is 20, and isless than 50 (50 is a highest threshold of the accidental situationevent). Therefore, when a terminal behavior corresponding to theaccidental situation event is triggered, the terminal needs to promptthe user, and perform the corresponding terminal behavior afterobtaining user confirmation.

403. The terminal detects an environment parameter of the terminal and aterminal status parameter of the terminal.

404. If the terminal detects a current operation of a user on theterminal, the terminal determines that a priority of a terminal statusparameter that is obtained based on the current operation is higher thana priority of the environment parameter.

Optionally, the terminal obtains preset priorities, and then selects,based on the priorities, a parameter with a higher priority from theenvironment parameter and the terminal status parameter, to determinethe target situation event.

In an embodiment, a priority of the environment parameter is higher thana priority of the terminal status parameter, and the terminal maypreferentially determine the target situation event based on theenvironment parameter. The third preset condition may be “The WiFisignal can be connected, and the cellular network is being used”.Alternatively, the third preset condition may be a conditioncorresponding to each of a plurality of environment parameters. In otherwords, the third preset condition may be a condition separately presetbased on a type of the environment parameter. A situation event may bedetermined only when each environment parameter meets a third presetcondition corresponding to the environment parameter.

For example, as shown in FIG. 6 , the terminal detects, at 15:00 on May20, 2017, that a network type parameter is “A WiFi signal is detected,and the cellular network is being used” and meets the third presetcondition of “The WiFi signal can be connected, and the cellular networkis being used”, a location parameter is “A terminal is located at alocation A, and duration=10 minutes” and meets a third preset conditionof “The location A is an area in which “home” is located”, and a speedparameter is “A terminal speed is 3 m/s” and meets a third presetcondition of “When the terminal is in a slowly-moving state, theterminal speed is 1 m/s to 5 m/s”. Therefore, the terminal maydetermine, based on the environment parameters that meet the respectivecorresponding third preset conditions, that a corresponding situationevent is “A network switchover can be performed: disconnect from acellular network when the WiFi network is connected”, and thendetermine, with reference to a user status parameter, a terminalbehavior to be triggered by the terminal.

Optionally, that the terminal obtains preset priorities, and thenselects, based on the priorities, a parameter with a higher priorityfrom the environment parameter and the terminal status parameter, todetermine the target situation event may be implemented by using step404 and step 405.

In a specific implementation, if the terminal detects that the user isperforming a current operation on the terminal, the terminal maydetermine that a priority of a terminal status parameter that isobtained based on the current operation performed by the user is higherthan a priority of the environment parameter.

In an embodiment, if the terminal detects, through a touchscreen, thatthe user is disabling the WiFi and enabling the cellular network on theterminal, the obtained terminal status parameter may be “A settingprogram is running, and the user is disabling the WiFi and enabling thecellular network”. In this case, the terminal may preferentiallyconsider the obtained terminal status parameter even if the environmentparameter indicates that there is a WiFi network that can be connected.

405. The terminal determines the target situation event based on theterminal status parameter that is obtained based on the currentoperation.

In an embodiment, the terminal may determine that the target situationevent is “Disable the WiFi, and enable the cellular network” based onthe terminal status parameter of “A setting program is running, and theuser is disabling the WiFi and enabling the cellular network” that isobtained based on the current operation.

406. If the environment parameter meets a first preset condition, andthe terminal status parameter meets a second preset condition, theterminal triggers a terminal behavior corresponding to the targetsituation event.

In some feasible embodiments, before the target situation event isdetermined based on the terminal status parameter that is obtained basedon the current operation of the user, the terminal may consider that thecurrent second preset condition is “The user is performing a currentoperation”. In other words, the terminal status parameter meets thesecond preset condition. Further, the terminal may not consider theenvironment parameter. Alternatively, when a priority of the terminalstatus parameter is higher than a priority of the environment parameter,the first preset condition is empty by default. In other words, anyenvironment parameter may be considered, by default, as meeting thefirst preset condition. Further, the terminal may trigger the terminalbehavior corresponding to the target situation event.

In this embodiment of the present invention, the terminal maypre-establish the correspondence between an environment parameter and asituation event and the correspondence between a terminal statusparameter and a situation event, and then detect the environmentparameter and the terminal status parameter. In addition, in this case,when detecting that the user is performing the current operation on theterminal, the terminal determines the target situation event based onthe terminal status parameter that is obtained based on the currentoperation, and triggers the terminal behavior corresponding to thetarget situation event. The correspondence is pre-established, so thatthe target situation event is determined more accurately andeffectively. In addition, the priorities of the terminal statusparameter and the environment parameter are set, and the priority of theterminal status parameter that is obtained based on the currentoperation of the user is higher than the priority of the environmentparameter by default, so that the triggered terminal behavior bettermeets user expectation, thereby improving intelligence of the terminal.

Referring to FIG. 8 , FIG. 8 is a schematic structural diagram of aterminal according to an embodiment of the present invention. Theterminal described in this embodiment includes a detection module 801, adetermining module 802, and a triggering module 803.

The detection module 801 is configured to detect an environmentparameter of the terminal and a terminal status parameter of theterminal.

Optionally, the environment parameter includes at least one of alocation parameter, a network type parameter, a temperature parameter, aluminance parameter, a speed parameter, an air quality parameter, and ahuman physiological parameter.

Optionally, the terminal status parameter includes a terminal statusparameter triggered by a user operation. The terminal status parametertriggered by the user operation includes at least one of a runningprogram status parameter, an unlocked state parameter, a screen-lockedstate parameter, and a hardware touch status parameter.

The determining module 802 is configured to determine a target situationevent based on the environment parameter and/or the terminal statusparameter.

Optionally, the target situation event may include an accidentalsituation event or a non-accidental situation event. If the targetsituation event is a non-accidental situation event, the triggeredterminal behavior corresponding to the target situation event is abehavior performed by the terminal without prompting a user.Alternatively, if the target situation event is an accidental situationevent, the triggered terminal behavior corresponding to the targetsituation event is a behavior performed by the terminal after theterminal prompts a user and obtains user confirmation.

The triggering module 803 is configured to: if the environment parametermeets a first preset condition, and the terminal status parameter meetsa second preset condition, trigger a terminal behavior corresponding tothe target situation event.

Optionally, the terminal further includes an obtaining module 804,configured to obtain:

one or more environment parameters; and

an establishment module 805, configured to: if the one or moreenvironment parameters meet a third preset condition, establish acorrespondence between the one or more environment parameters and asituation event.

Optionally, the obtaining module 804 is further configured to obtain oneor more terminal status parameters of the terminal.

The establishment module 805 is further configured to: if the one ormore terminal status parameters of the terminal meet a fourth presetcondition, establish a correspondence between the one or more terminalstatus parameters of the terminal and a situation event.

Optionally, the obtaining module 804 is specifically configured to:obtain preset priorities, and select, based on the priorities, aparameter with a higher priority from the environment parameter and theterminal status parameter, to determine the target situation event.

Optionally, the obtaining module 804 is specifically configured to: if acurrent operation of the user on the terminal is detected, determinethat a priority of a terminal status parameter that is obtained based onthe current operation is higher than a priority of the environmentparameter, and determine the target situation event based on theterminal status parameter that is obtained based on the currentoperation.

In this embodiment of the present invention, the terminal first detectsthe environment parameter and the status parameter, and then determinesthe target situation event based on the environment parameter and/or theterminal status parameter. If the environment parameter meets the firstpreset condition, and the terminal status parameter meets the secondpreset condition, the terminal triggers the terminal behaviorcorresponding to the target situation event. Both the environmentparameter and the terminal status parameter are detected, so that thetriggered terminal behavior better meets user expectation, therebyimproving intelligence of the terminal.

Referring to FIG. 9 , FIG. 9 is a schematic structural diagram ofanother terminal according to an embodiment of the present invention.The terminal described in this embodiment includes components such as aradio frequency (Radio Frequency, RF) circuit 110, a memory 120, anotherinput device 130, a display screen 140, a sensor 150, an input/outputsubsystem 170, a processor 190, and a power supply 190. A person skilledin the art may understand that a structure of the terminal shown in FIG.9 constitutes no limitation on the terminal. The terminal may includemore or fewer components than those shown in the figure, or combine someparts, or split some parts, or have different component arrangements. Aperson skilled in the art may understand that the display screen 140 isa user interface (UI, User Interface), and the terminal may include moreor fewer user interfaces than that shown in the figure.

The following describes the components of the terminal in detail withreference to FIG. 9 .

The radio frequency circuit 110 may be configured to: receive and send asignal in an information receiving or sending process or a call process;particularly, after receiving downlink information of a base station,send the downlink information to the processor 180 for processing; andsend designed uplink data to the base station. Generally, the radiofrequency circuit includes but is not limited to an antenna, at leastone amplifier, a transceiver, a coupler, an LNA (Low Noise Amplifier,low noise amplifier), a duplexer, and the like. In addition, the radiofrequency circuit 110 may further communicate with a network and anotherdevice through wireless communication. The wireless communication mayuse any communications standard or protocol that includes but is notlimited to: a GSM (Global System of Mobile Communication, Global Systemfor Mobile Communications), a GPRS (General Packet Radio Service,general packet radio service), CDMA (Code Division Multiple Access, CodeDivision Multiple Access), WCDMA (Wideband Code Division MultipleAccess, Wideband Code Division Multiple Access), LTE (Long TermEvolution, Long Term Evolution), an email, an SMS (Short MessagingService, short message service), and the like.

The memory 120 may be configured to store a software program and amodule, and the processor 180 executes various functional applicationsof the terminal 1 and data processing by running the software programand the module that are stored in the memory 120. The memory 120 maymainly include a program storage area and a data storage area. Theprogram storage area may store an operating system, an applicationprogram that is required by at least one function (such as a soundplaying function or an image playing function), and the like. The datastorage area may store data (such as audio data or a phonebook) that iscreated based on use of the terminal, and the like. In addition, thememory 120 may include a high-speed random access memory, or may includea non-volatile memory, such as at least one magnetic disk storagedevice, a flash memory device, or another volatile solid-state storagedevice.

The another input device 130 may be configured to receive an inputnumber or character information, and generate a key signal input relatedto user settings and function control of the terminal. Specifically, theanother input device 130 may include, but is not limited to: one or moreof a physical keyboard, a function key (such as a volume control key oran on/off key), a trackball, a mouse, a joystick, an optical mouse (theoptical mouse is a touch-sensitive surface that does not display visualoutput, or an extension of a touch-sensitive surface formed by atouchscreen), and the like. The another input device 130 is connected toanother input device controller 171 in the input/output subsystem 170,and performs signal exchange with the processor 180 under the control ofthe another input device controller 171.

The display screen 140 may be configured to display information that isinput by a user or information provided for the user, and various menusof the terminal, and may further receive user input. Specifically, thedisplay screen 140 may include a display panel 141 and a touch panel142. The display panel 141 may be configured in a form of an LCD (LiquidCrystal Display, liquid crystal display), an OLED (OrganicLight-Emitting Diode, organic light-emitting diode), or the like. Thetouch panel 142, also referred to as a touchscreen, a touch-sensitivescreen, or the like, may collect a contact or contactless operationperformed by the user on or near the touch panel 142 (for example, anoperation performed by the user on or near the touch panel 142 by usingany proper object or accessory such as a finger or a stylus, or a motionsensing operation. An operation type of the operation is a single-pointcontrol operation, a multipoint control operation, or the like), and maydrive a corresponding connection apparatus based on a preset program.Optionally, the touch panel 142 may include two parts: a touch detectionapparatus and a touch controller. The touch detection apparatus detectsa touch orientation and gesture of the user, detects a signal brought bythe touch operation, and sends the signal to the touch controller. Thetouch controller receives touch information from the touch detectionapparatus, converts the touch information into information that can beprocessed by the processor, and then sends the information to theprocessor 180. The touch controller can receive and execute a commandsent by the processor 180. In addition, the touch panel 142 may beimplemented by using a plurality of types such as a resistive type, acapacitive type, infrared, and a surface acoustic wave. Further, thetouch panel 142 may cover the display panel 141. The user may perform,based on content displayed on the display panel 141 (the displayedcontent includes but is not limited to a soft keyboard, a virtual mouse,a virtual key, an icon, and the like), an operation on or near the touchpanel 142 that covers the display panel 141. After detecting theoperation on or near the touch panel 142, the touch panel 142 sends theoperation to the processor 180 by using the input/output subsystem 170to determine user input. Then, the processor 180 provides, based on theuser input, corresponding visual output on the display panel 141 byusing the input/output subsystem 170. Although the touch panel 142 andthe display panel 141 in FIG. 4 are used as two independent parts toimplement input and input functions of the terminal, in someembodiments, the touch panel 142 and the display panel 141 may beintegrated to implement the input and output functions of the terminal.

The terminal may further include at least one type of sensor 150, suchas a light sensor, a speed sensor, a GPS sensor, and another sensor.Specifically, the light sensor may include an ambient light sensor and aproximity sensor. The ambient light sensor may adjust luminance of thedisplay pane 141 based on brightness of ambient light. The proximitysensor may turn off the display panel 141 and/or backlight when theterminal moves to an ear. As a type of speed sensor, the accelerationsensor can detect a value of an acceleration in each direction(generally three axes), and detect a value and a direction of gravitywhen the acceleration sensor is static, and is applicable to anapplication for recognizing a terminal posture (for example, switchingbetween a landscape screen and a portrait screen, relevant games, andmagnetometer posture calibration), a function related to vibrationrecognition (such as a pedometer or a knock), and the like. Othersensors such as a gyroscope, a barometer, a hygrometer, a thermometer,and an infrared sensor may also be configured on the terminal. Detailsare not described herein.

The input/output subsystem 170 is configured to control an externalinput/output device, and may include the another input device controller171, a sensor controller 172, and a display controller 173. Optionally,one or more other input device controllers 171 receive a signal from theanother input device 130 and/or send a signal to the another inputdevice 130. The another input device 130 may include a physical button(a press button, a rocker button, or the like), a dial pad, a sliderswitch, a joystick, a click scroll wheel, and an optical mouse (theoptical mouse is a touch-sensitive surface that does not display visualoutput, or an extension of a touch-sensitive surface formed by atouchscreen). It should be noted that the another input devicecontroller 171 may be connected to any one or more of the foregoingdevices. The display controller 173 in the input/output subsystem 170receives a signal from the display screen 140 and/or sends a signal tothe display screen 140. After the display screen 140 detects user input,the display controller 173 converts the detected user input intointeraction with a user interface object displayed on the display screen140, to implement human-computer interaction. The sensor controller 172may receive a signal from one or more sensors 150 and/or send a signalto one or more sensors 150.

The processor 180 is a control center of the terminal, and is connectedto all parts of the entire terminal by using various interfaces andcables. The processor 180 runs or executes a software program and/or amodule stored in the memory 120, and invokes data stored in the memory120, to execute various functions of the terminal and process data, toperform overall monitoring on the terminal. Optionally, the processor180 may include one or more processing units. Preferably, an applicationprocessor and a modem processor may be integrated into the processor180. The application processor mainly processes an operating system, auser interface, an application program, and the like. The modemprocessor mainly processes wireless communication. It may be understoodthat the modem processor may alternatively be not integrated into theprocessor 180.

The terminal further includes the power supply 190 (such as a battery)that supplies power to each part. Preferably, the power supply may belogically connected to the processor 180 by using a power supplymanagement system, so that functions such as charging, discharging, andpower consumption management are implemented by using the power supplymanagement system.

Although not shown in the figure, the terminal may further include acamera, a Bluetooth module, and the like. Details are not describedherein.

Specifically, the processor 180 may invoke a program instruction storedin the memory 120, to implement the method shown in this embodiment ofthe present invention.

Specifically, the processor 180 invokes the program instruction storedin the memory 170 to perform the following steps

detecting an environment parameter of a terminal and a terminal statusparameter of the terminal;

determining a target situation event based on the environment parameterand/or the terminal status parameter; and

if the environment parameter meets a first preset condition, and theterminal status parameter meets a second preset condition, triggering aterminal behavior corresponding to the target situation event.

The method performed by the processor in this embodiment of the presentinvention is described from a perspective of the processor. It may beunderstood that in this embodiment of the present invention, anotherhardware structure is needed to cooperate with the processor to performthe foregoing method. For example, the terminal interacts with anotherdevice or a server, for example, detects the environment parameter ofthe terminal. The processor 180 controls the sensor 150 to receiverelated data, and detects the terminal status parameter of the terminal.The processor 180 controls the another input device 130, the displayscreen 140, and the like to receive related data, determines the targetsituation event based on the environment parameter and/or the terminalstatus parameter, and triggers the terminal behavior corresponding tothe target situation event. This may be implemented by the processor 803by controlling a storage program in the memory 805. A specificimplementation process is not described in detail and is not limited inthis embodiment of the present invention.

Optionally, the terminal may implement, by using the processor 2000 andanother device, corresponding steps performed by the terminal in theterminal behavior triggering methods in the embodiments corresponding toFIG. 1 and FIG. 4 . It should be understood that this embodiment of thepresent invention is an entity apparatus embodiment corresponding to themethod embodiments, and description of the method embodiments is alsoapplicable to this embodiment of the present invention.

In this embodiment of the present invention, the terminal first detectsthe environment parameter and the status parameter, and then determinesthe target situation event based on the environment parameter and/or theterminal status parameter. If the environment parameter meets the firstpreset condition, and the terminal status parameter meets the secondpreset condition, the terminal triggers the terminal behaviorcorresponding to the target situation event. Both the environmentparameter and the terminal status parameter are detected, so that thetriggered terminal behavior better meets user expectation, therebyimproving intelligence of the terminal.

Another embodiment of the present invention provides a computer readablestorage medium. The computer readable storage medium stores a computerprogram. When the computer program is executed by a processor, thefollowing steps may be implemented: detecting an environment parameterof a terminal and a terminal status parameter of the terminal;determining a target situation event based on the environment parameterand/or the terminal status parameter; and if the environment parametermeets a first preset condition, and the terminal status parameter meetsa second preset condition, triggering a terminal behavior correspondingto the target situation event.

It should be noted that, for a specific process in which the computerreadable storage medium is executed by the processor, refer to themethods described in the first embodiment and the second embodiment.Details are not described herein again.

Still another embodiment of the present invention provides a computerprogram product that includes an instruction. When the computer programproduct runs on a computer, the computer performs the following steps:detecting an environment parameter of a terminal and a terminal statusparameter of the terminal; determining a target situation event based onthe environment parameter and/or the terminal status parameter; and ifthe environment parameter meets a first preset condition, and theterminal status parameter meets a second preset condition, triggering aterminal behavior corresponding to the target situation event.

The computer readable storage medium may be an internal storage unit ofthe terminal in any one of the foregoing embodiments, for example, ahard disk or a memory of the terminal. The computer readable storagemedium may alternatively be an external storage device of the terminal,for example, a removable hard disk, a smart media card (Smart MediaCard, SMC), a secure digital (Secure Digital, SD) card, a flash card(Flash Card), and the like that are configured on the terminal. Further,the computer readable storage medium may alternatively include both theinternal storage unit and the external storage device of the terminal.The computer readable storage medium is configured to store the computerprogram and other programs and data required by the terminal. Thecomputer readable storage medium may be further configured totemporarily store data that has been output or is to be output.

It should be noted that, for a specific implementation process of thecomputer program product that includes the instruction, refer to themethods described in the first embodiment and the second embodiment.Details are not described herein again.

Based on a same inventive concept, a problem-resolving principle of theterminal provided in this embodiment of the present invention is similarto that of the method embodiments of the present invention. Therefore,for implementation of the terminal, refer to the implementation of themethods. For brevity of description, details are not described hereinagain.

A person of ordinary skill in the art may understand that all or some ofthe procedures for implementing the methods in the foregoing embodimentsmay be implemented by a computer program instructing relevant hardware.The program may be stored in a computer readable storage medium. Whenthe program runs, the procedures of the method embodiments areperformed. The storage medium may be a magnetic disk, an optical disc, aread-only memory (Read-Only Memory, ROM), a random access memory (RandomAccess Memory, RAM), or the like.

The invention claimed is:
 1. A method, comprising: detecting, by aterminal, an environment parameter of the terminal and a terminal statusparameter of the terminal; determining, by the terminal, a first targetsituation event when the environment parameter meets a first presetcondition; determining, by the terminal, a second target situation eventaccording to the environment parameter and the terminal statusparameter, wherein the first target situation event is different fromthe second target situation event; and triggering, by the terminal, aterminal behavior corresponding to the second target situation eventbased on that the environment parameter meets the first preset conditionand the terminal status parameter meets a second preset condition,wherein the terminal status parameter meeting the second presetcondition is triggered by a user operation, wherein the terminal statusparameter comprises at least one of a running program status parameter,an unlocked state parameter, a screen-locked state parameter, or ahardware touch status parameter, and wherein the environment parametercomprises at least one of a location parameter, a network typeparameter, a temperature parameter, a luminance parameter, a speedparameter, an air quality parameter, or a human physiological parameter.2. The method according to claim 1, wherein the environment parameter isdetected by a sensor of the terminal.
 3. The method according to claim1, wherein the determining the first target situation event comprises:obtaining preset priorities; and determining that a priority of theenvironment parameter is higher than a priority of the terminal statusparameter.
 4. The method according to claim 1, wherein the methodfurther comprises: determining, by the terminal, a third targetsituation event according to the environment parameter and the terminalstatus parameter, wherein the third target situation event is differentfrom the first target situation event and the second target situationevent; and triggering, by the terminal, a second terminal behaviorcorresponding to the third target situation event when the environmentparameter meets the first preset condition and the terminal statusparameter meets a third preset condition.
 5. The method according toclaim 1, wherein the terminal status parameter meeting the second presetcondition comprises the terminal status parameter meeting a presetterminal status for a preset first time duration.
 6. A terminal, whereinthe terminal comprises: a non-transitory memory, configured to storeprogramming; and at least one processor, configured to execute theprogramming in the non-transitory memory to cause the terminal toperform: detecting an environment parameter of the terminal and aterminal status parameter of the terminal; determining a first targetsituation event when the environment parameter meets a first presetcondition; determining a second target situation event according to theenvironment parameter and the terminal status parameter, wherein thefirst target situation event is different from the second targetsituation event; and triggering a terminal behavior corresponding to thesecond target situation event based on that the environment parametermeets the first preset condition and the terminal status parameter meetsa second preset condition, wherein the terminal status parameter meetingthe second preset condition is triggered by a user operation, whereinthe terminal status parameter comprises at least one of a runningprogram status parameter, an unlocked state parameter, a screen-lockedstate parameter, or a hardware touch status parameter, and wherein theenvironment parameter comprises at least one of a location parameter, anetwork type parameter, a temperature parameter, a luminance parameter,a speed parameter, an air quality parameter, or a human physiologicalparameter.
 7. The terminal according to claim 6, wherein the environmentparameter is detected by a sensor of the terminal.
 8. The terminalaccording to claim 6, wherein the determining the first target situationevent comprises: obtaining preset priorities; and determining that apriority of the environment parameter is higher than a priority of theterminal status parameter.
 9. The terminal according to claim 6, whereinthe at least one processor is further configured to execute theprogramming in the non-transitory memory to cause the terminal toperform: determining a third target situation event according to theenvironment parameter and the terminal status parameter, wherein thethird target situation event is different from the first targetsituation event and the second target situation event; and triggering asecond terminal behavior corresponding to the third target situationevent when the environment parameter meets the first preset conditionand the terminal status parameter meets a third preset condition. 10.The terminal according to claim 6, wherein the terminal status parametermeeting the second preset condition comprises the terminal statusparameter meeting a preset terminal status for a preset first timeduration.
 11. A non-transitory computer program product that comprisesinstructions, wherein when the instructions run on a terminal, theinstructions cause the terminal to perform operations, the operationsincluding: detecting an environment parameter of the terminal and aterminal status parameter of the terminal; determining a first targetsituation event when the environment parameter meets a first presetcondition; determining a second target situation event according to theenvironment parameter and the terminal status parameter, wherein thefirst target situation event is different from the second targetsituation event; and triggering a terminal behavior corresponding to thesecond target situation event based on that the environment parametermeets the first preset condition and the terminal status parameter meetsa second preset condition, wherein the terminal status parameter meetingthe second preset condition is triggered by a user operation, whereinthe terminal status parameter comprises at least one of a runningprogram status parameter, an unlocked state parameter, a screen-lockedstate parameter, or a hardware touch status parameter, and wherein theenvironment parameter comprises at least one of a location parameter, anetwork type parameter, a temperature parameter, a luminance parameter,a speed parameter, an air quality parameter, or a human physiologicalparameter.
 12. The non-transitory computer program product according toclaim 11, wherein the environment parameter is detected by a sensor ofthe terminal.
 13. The non-transitory computer program product accordingto claim 11, wherein the determining the first target situation eventcomprises: obtaining preset priorities; and determining that a priorityof the environment parameter is higher than a priority of the terminalstatus parameter.
 14. The non-transitory computer program productaccording to claim 11, the operations further comprising: determining,by the terminal, a third target situation event according to theenvironment parameter and the terminal status parameter, wherein thethird target situation event is different from the first targetsituation event and the second target situation event; and triggering,by the terminal, a second terminal behavior corresponding to the thirdtarget situation event when the environment parameter meets the firstpreset condition and the terminal status parameter meets a third presetcondition.
 15. The non-transitory computer program product according toclaim 11, wherein the terminal status parameter meeting the secondpreset condition comprises the terminal status parameter meeting apreset terminal status for a preset first time duration.